package shujia.day19;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.function.Consumer;

/*
    消费型接口
    @FunctionalInterface
    public interface Consumer<T> {
        void accept(T t);
    }
 */
class Test6{
    public static void fun1(Long timestamp,Consumer<Long> consumer){
        consumer.accept(timestamp);
    }
}

public class LambdaDemo6 {
    public static void main(String[] args) {
//        Test6.fun1(System.currentTimeMillis(), (Long t)->{
//            Date date = new Date(t);
//            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//            System.out.println(sdf.format(date));
//        });

        Test6.fun1(System.currentTimeMillis(), t->System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(t))));

    }
}
